package net.zoneland.knowledge.dao;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.type.JdbcType;

import net.zoneland.knowledge.model.PartyCalendarToday;

/**
 * 党史今日数据库mapper.
 * @author bcc
 */
@Mapper
public interface PartyCalendarTodayMapper {

    /**
     * 根据日期获取党史今日信息.
     * @param monthDate 日期格式是 MM-dd 年月
     * @return 党史今日信息
     */
    @Select({
            "select ID, PARTY_DATE, PICTURE_NAME, PICTURE_FILE, INTRODUCTION, CONTENT ",
            "FROM AITK_PARTY_HIST_TODAY ",
            "WHERE PARTY_DATE=#{monthDate,jdbcType=VARCHAR}"
    })
    @Results(id = "PartyCalendarTodayMap",
            value = {
            @Result(column = "ID", property = "id", jdbcType = JdbcType.VARCHAR, id = true),
            @Result(column = "PARTY_DATE", property = "partyDate", jdbcType = JdbcType.VARCHAR),
            @Result(column = "PICTURE_NAME", property = "pictureName", jdbcType = JdbcType.VARCHAR),
            @Result(column = "PICTURE_FILE", property = "pictureFile", jdbcType = JdbcType.BINARY),
            @Result(column = "INTRODUCTION", property = "introduction", jdbcType = JdbcType.VARCHAR),
            @Result(column = "CONTENT", property = "content", jdbcType = JdbcType.VARCHAR),
    })
    PartyCalendarToday queryByDateString(@Param("monthDate") String monthDate);
}
